package com.shanlitech.bluetooth;

import com.shanlitech.lbs.geometry.Point2D;
import com.shanlitech.lbs.geometry.Point3D;
import com.shanlitech.lbs.map.LbsDatabase;
import com.shanlitech.lbs.map.MapFlat;
import com.shanlitech.lbs.map.MapPartition;

public class AppContext {
    private static MapFlat flat;
    private static final Point2D location = new Point2D();

    public static void setFlat(String partition,int floor) {
        MapPartition p = LbsDatabase.getInstance().getPartition(partition);
        if( p != null ) {
            MapFlat f = p.getFlat(floor);
            if( f != null ) {
                flat = f;
            }
        }
    }

    public static MapFlat getFlat() {
        if( flat == null ) {
            flat = LbsDatabase.getInstance().getDefaultFlat();
        }
        return flat;
    }

    public static void setLocation(Point2D point) {
        location.copy(point);
    }

    public static Point2D getLocation() {
        return location;
    }
}
